{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-11-21T05:44:02.391311Z",
     "start_time": "2025-11-21T05:44:02.385976Z"
    }
   },
   "source": [
    "import torch\n",
    "\n",
    "distance = torch.tensor([[1.0], [2.0], [3.0], [4.0]], dtype=torch.float32)\n",
    "distance, distance.shape\n"
   ],
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([[1.],\n",
       "         [2.],\n",
       "         [3.],\n",
       "         [4.]]),\n",
       " torch.Size([4, 1]))"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 11
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-11-21T05:44:02.415238Z",
     "start_time": "2025-11-21T05:44:02.409853Z"
    }
   },
   "cell_type": "code",
   "source": [
    "weight = torch.tensor(2.3, dtype=torch.float32)\n",
    "weight, weight.shape"
   ],
   "id": "41f1667d5c5b4d40",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor(2.3000), torch.Size([]))"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 12
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-11-21T05:44:02.432267Z",
     "start_time": "2025-11-21T05:44:02.425622Z"
    }
   },
   "cell_type": "code",
   "source": [
    "bias = torch.tensor(8.0, dtype=torch.float32)\n",
    "bias, bias.shape"
   ],
   "id": "c66bc2d525c1c88e",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor(8.), torch.Size([]))"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 13
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-11-21T05:44:02.494494Z",
     "start_time": "2025-11-21T05:44:02.489064Z"
    }
   },
   "cell_type": "code",
   "source": [
    "output = weight * distance + bias\n",
    "output, output.shape"
   ],
   "id": "b1cc98f7b2e57be5",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([[10.3000],\n",
       "         [12.6000],\n",
       "         [14.9000],\n",
       "         [17.2000]]),\n",
       " torch.Size([4, 1]))"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 14
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
